﻿using Coldairarrow.Business.baskstage.RefundType;
using Coldairarrow.Entity.baskstage.RefundType;
using Coldairarrow.Util;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace Coldairarrow.Api.Controllers.baskstage.RefundType
{
    [Route("/baskstage/RefundType/[controller]/[action]")]
    public class BS_RefundRTypeController : BaseApiController
    {
        #region DI

        public BS_RefundRTypeController(IBS_RefundRTypeBusiness bS_RefundRTypeBus)
        {
            _bS_RefundRTypeBus = bS_RefundRTypeBus;
        }

        IBS_RefundRTypeBusiness _bS_RefundRTypeBus { get; }

        #endregion

        #region 获取

        [HttpPost]
        public async Task<PageResult<BS_RefundRType>> GetDataList(PageInput<ConditionDTO> input)
        {
            return await _bS_RefundRTypeBus.GetDataListAsync(input);
        }

        [HttpPost]
        public async Task<BS_RefundRType> GetTheData(IdInputDTO input)
        {
            return await _bS_RefundRTypeBus.GetTheDataAsync(input.id);
        }

        #endregion

        #region 提交

        [HttpPost]
        public async Task SaveData(BS_RefundRType data)
        {
            if (data.Id.IsNullOrEmpty())
            {
                InitEntity(data);

                await _bS_RefundRTypeBus.AddDataAsync(data);
            }
            else
            {
                await _bS_RefundRTypeBus.UpdateDataAsync(data);
            }
        }

        [HttpPost]
        public async Task DeleteData(List<string> ids)
        {
            await _bS_RefundRTypeBus.DeleteDataAsync(ids);
        }

        #endregion
    }
}